package cn.afterturn.common.model;

import java.io.Serializable;

/**
 * 基础返回类
 * 
 * @author JueYue
 * @date 2014年5月13日 下午4:55:29
 */
public class ResponseModel implements Serializable {

    private static final long  serialVersionUID = 5831231522873089422L;

    public static final String SUCCESS          = "操作成功";

    public static final String FAIL             = "操作失败";

    public static final String SYSTEM_ERROR     = "系统异常";

    public static ResponseModel ins() {
        return new ResponseModel();
    }

    public static ResponseModel ins(Object result) {
        return new ResponseModel(true, result);
    }

    /**
     * 是否成功
     */
    private boolean success;
    /**
     * 消息
     */
    private String  msg;
    /**
     * 返回对象
     */
    private Object  result;

    public ResponseModel() {
        success = true;
    }

    public ResponseModel(boolean success) {
        this.success = success;
    }

    public ResponseModel(String msg) {
        this.success = false;
        this.msg = msg;
    }

    public ResponseModel(boolean success, Object result) {
        this.success = success;
        this.result = result;
    }

    public ResponseModel(boolean success, String msg, Object result) {
        this.success = success;
        this.msg = msg;
        this.result = result;
    }

    public String getMsg() {
        return msg;
    }

    public Object getResult() {
        return result;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

}
